<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/layouts/taglib.jsp" %>
<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>用户反馈</title>
		<%@ include file="/WEB-INF/layouts/index-header.jsp" %>
	</head>
	<body>
		<div class="tpanel">
			<div class="panel-content">
				<div class="container-fluid">
					<div id="tool">
						<form id="searchForm" class="form-inline" onsubmit="return search('#searchForm','#table')"
							  style="margin-top:20px;margin-bottom:20px;">
							<div class="form-group">
								<label class="">用户名：</label>
								<input type="text" name="search_LIKES_name" class="form-control" />
							</div>
							<div class="form-group">
								<button type="submit" class="btn btn-primary radius">
								  <span class="glyphicon glyphicon-search"></span> 查询
								</button>
							</div>
						</form>
					</div> 
					<table id="table"></table>
				</div>
			</div>
		</div>

		<script type="text/javascript">
            changeTitle('用户反馈');
        $(function() {

            $('#table').bootstrapTable({
                url: '${ctx}/admin/advice/list',
                idField : 'id',
                striped : true,
                uniqueId : 'id',
                /*checkbox : true,*/
                /*clickToSelect : true,*/
                queryParams : queryParams,
                responseHandler : responseHandler,
                columns: [/*{
                    field: 'ck',
                    checkbox : true
                },*/{
                    title: '#',
                    width : 50,
                    align : 'center',
                    formatter: snFormatter
                },{
                    field: 'content',
                    searchable : true,
                    sortable : true,
                    title: '反馈',
                    align : 'center'
                },{
                    field: 'createdTime',
                    searchable : true,
                    sortable : true,
                    title: '提交时间',
                    align : 'center'
                }, {
                    field: 'username',
                    searchable : true,
                    sortable : true,
                    title: '用户名',
                    align : 'center'
                }, {
                    field: 'tel',
                    searchable : true,
                    sortable : true,
                    title: '电话',
                    align : 'center'
                }, {
                    field: 'email',
                    searchable : true,
                    sortable : true,
                    title: '邮箱',
                    align : 'center'
                }, {
                    field: 'requestTime',
                    searchable : true,
                    title: '操作',
                    'class' : 'nowrap',
                    align : 'center',
                    formatter : operateFormatter
                }]
            });

        });

		function del(id,name) {
            topBootbox.prompt({
                title: "请输入您的管理密码以确定删除此系统角色",
                onEscape : true,
                backdrop : true,
                animate : true,
                buttons: {
                    confirm: {
                        label: '删除',
                        className: 'btn-danger'
                    },
                    cancel: {
                        label: '取消',
                        className: ''
                    }
                },
                inputType: 'password',
                callback: function (result) {
                    if(result) {
                        $.post('${ctx}/admin/sys-role/careful-delete',{id:id,password:result},function(resp) {
                            if(resp.code == 'OK') {
                                topLayer.msg('删除成功', {icon: 1});
                                $('#table').bootstrapTable('refresh');
                            }else {
                                topLayer.msg('删除失败:' + resp.message, {icon: 2});
                            }
                        },'json');
                    }
                }
            });
		}

		function tip() {
            topLayer.msg('开发者具有最高权限', {icon: 6});
		}

        function operateFormatter(value,row,index) {
            var content = '';
            if(row.code == 'Developer') {
            	content += '<a href="javascript:tip()" title="开发者具有最高权限"><i class="iconfont icon-caidanfenpeiquanxian"></i></a>';
			}else {
                content += '<a href="${ctx}/admin/sys-role/assign-perm?id=' + row.id + '" title="分配权限"><i class="iconfont icon-caidanfenpeiquanxian"></i></a>';
			}
            content += '&nbsp;&nbsp;&nbsp;&nbsp;';
            content += '<a href="${ctx}/admin/sys-role/update?id=' + row.id + '" title="编辑"><i class="iconfont icon-iconfontcolor32"></i></a>';
            if(row.code != 'Developer' && row.code != 'SuperAdmin' && row.code != 'Admin') {
                content += '&nbsp;&nbsp;&nbsp;&nbsp;';
                content += '<a href="javascript:del(' + row.id + ')" title="删除"><i class="iconfont icon-shanchu"></i></a>';
            }
            return content;
        }
	</script>

	</body>
</html>
